{layout name="layouts/admin" /}

<!-- jQuery 2.1.4 -->
{js href="/static/admin/plugins/jQuery/jquery-1.9.1.min.js" /}


<!-- 富文本编辑器文件 -->
{js href="/static/admin/ueditor/ueditor.config.js" /}
{js href="/static/admin/ueditor/ueditor.all.js" /}
<style>
    .frame {
        width: 200px;
        height: 30px;
        border: none;
        vertical-align: middle;
    }
    .file{
        position: absolute;
        filter: alpha(opacity:0);
        opacity: 0;
        width: 70px;
        height:40px;
    }
    .groupimgfile{
        right: 48%;
        top: 30%;
    }
    .radioclass{
        margin-right:20px;
    }
</style>
<div class="panel-heading">{$detail.id?"编辑":"添加"}banner图</div>
<div class="panel-body">
    <form action="/wechatgroup/doAddbanner" method="POST" enctype="multipart/form-data" name="groupimgform">
        <div class="box-body">
            <div class="form-group">
                <label>banner标题</label>
                <input type="hidden" name="id" value="{$detail.id}"/>
                <input type="text" name="bannername" value="{$detail.banner_name}" class="form-control" placeholder="请输入banner标题">
            </div>

            <div class="form-group">
                <label>banner类型</label>
                <select class="form-control" name="datatype" id="datatype">

                    <option value="0" {$detail.data_type==0?"selected":""}>医者会</option>
                    <option value="1" {$detail.data_type==1?"selected":""}>患者会</option>

                </select>
            </div>

            <div class="form-group" style="clear:both;padding-top:20px;">
                <label>banner图</label>
                    <div>
                        <input type="text" class="form-control" name="bannerimg" id="bannerimg" style="float:left;width:400px;" value="{$detail.banner_img}" />
                        <input type="hidden" name="imgfiletype" id="imgfiletype"/>
                        <input type="button" class="btn btn-primary" value="浏览...">
                        <input type="file" name="bannerimgfile" class="file groupimgfile" size="28" onchange="document.getElementById('bannerimg').value=this.value">
                        <input type="button" name="bannerimgupload" id="bannerimgupload" class="btn btn-primary" style="margin-left: 30px;" value="上传">
                        <iframe id="bannerimgframe" name="bannerimgframe"  class="frame"></iframe>
                    </div>
            </div>



            <div class="form-group">
                <label style="display: block;">banner内容</label>
                <script type="text/plain" name="bannermsg" id="bannermsg" style="width:100%;height:240px;">
    {$detail.banner_msg|raw}
</script>
            </div>


            <div class="form-group">
                <button type="submit" id="bannersave" class="btn btn-primary">确认保存</button>
            </div>
        </div>
    </form>
</div>

<script>
    //实例化编辑器
    var bannermsg = UE.getEditor('bannermsg',{autoHeightEnabled:false});
    //banner图上传
    $('#bannerimgupload').click(function(){
        document.groupimgform.action="/wechatgroup/uploadfiles";
        document.groupimgform.target="bannerimgframe";
        $("#imgfiletype").val(4);
        document.groupimgform.submit();
    });

    $('#bannersave').click(function(){
        document.groupimgform.action="/wechatgroup/doAddbanner";
        document.groupimgform.target="";
        document.groupimgform.submit();
    });

</script>